#!/bin/bash

# Example:
# X get config
#
# Usage:
#   X get [options...]   
#
# Options
#   -h, --help
#   -p, --plugin <plugin_name>
#   -a, --all
#
parser_options() {
  local options=(
    "-a,--all"
    "-f,--follow"
    "-h,--help"
    "--name <name>"
    "--description <custom_description>"
  )

  parser_one_options() {
    local flags=$(string::split , $(echo $@ | awk '{print $1}'))
    local var=$(string::split , $(echo $@ | awk '{print $2}'))
  }

  local index=0
  local length=${#options[@]}
  while [ $index -lt $length ]; do
    local element=${options[index]}
    parser_one_options $element
    
    index=$((index + 1))
  done

  # while [[ $# -gt 0 ]]; do
  #   local key=$1
  #   local value=$2
  #   case $key in
  #     -h | --help)
  #       help
  #       exit 0
  #       ;;
  #     -u | --update)
  #       os::set_var is_plugin_update true
  #       shift
  #       ;;
  #     *)
  #       if [ "$(string::match $key ^-)" = "true" ]; then
  #         echo "ERROR: unknown parameter \"$key\""
  #         help
  #         exit 1
  #       fi

  #       shift
  #       ;;
  #   esac
  # done
}

export -f parser_options
